#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<stdlib.h>
int main()
{
	int* p1 = (int*)malloc(40);
	int* p2 = (int*)calloc(40,sizeof(int));
	if(p1 == NULL && p2 ==NULL)
	{
		perror("malloc");
		return 1;
	}
	for (int i = 0; i < 10; i++)
	{
		*(p1 + i) = i;
	}
	for (int i = 0; i < 10; i++)
	{
		printf("%d ", *(p1 + i));
	}
	printf("\n");
	for (int i = 0; i < 10; i++)
	{
		printf("%d ", *(p2 + i));
	}
	int* ptr = (int*)realloc(p2, 15 * sizeof(int));
	if (ptr != NULL)
	{
		p2 = ptr;
		ptr = NULL;
	}
	else
	{
		perror("realloc");
	}
	for (int i = 0; i < 15; i++)
	{
		*(p2 + i) = i;
	}
	printf("\n");
	for (int i = 0; i < 15; i++)
	{
		printf("%d ", *(p2 + i));
	}
	free(p1);
	free(p2);
	p1 = NULL;
	p2 = NULL;
	return 0;
}